<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<script type="text/javascript" src="scripts/boot.js"></script>
</head>
<body style="border: 0px; margin: 0px; padding: 0px;width: 100%;height: 100%">
	<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
	    <table style="width:100%;">
	      	 <tr>
	            <td style="width:100%;"></td>
	            <td style="white-space:nowrap;">
	                <span>编号：</span>
	                <input id="serialNum" class="mini-textbox" emptyText="请输入编号" style="width:120px;" onenter="onKeyEnter"/>   
	                <span>调出仓库：</span>
	                <input id="recallWhName" class="mini-textbox" emptyText="请输入调出仓库名称" style="width:120px;" onenter="onKeyEnter"/>  
	            	<span>调入仓库：</span>
	                <input id="callWhName" class="mini-textbox" emptyText="请输入调入仓库名称" style="width:120px;" onenter="onKeyEnter"/>  
	            </td>
	            <td style="white-space:nowrap;">
                	<a class="mini-button" iconCls="icon-search" onclick="search()">查询</a>
                </td>
	        </tr>
	    </table>           
	</div>
	<div class="mini-fit" >
	<div id="datagrid1" class="mini-datagrid " idField="id" pageSize="20" url="allocation_audit_view.do" style="width:100%;height:100%;" multiSelect="true">
		<div property="columns">
			<div type="indexcolumn"></div>
			<div name="action" width="60" headerAlign="center" align="center" renderer="onActionRenderer">相关操作</div>
			<div field="serialNum" width="100" headerAlign="center" align="center">编号</div>
			<div field="title" width="100" headerAlign="center" align="center">标题</div>
			<div field="recallWhName" width="100" headerAlign="center" align="center">调出仓库</div>
			<div field="callinWhName" width="100" headerAlign="center" align="center">调入仓库</div>
			<div field="status" width="70" headerAlign="center" align="center">状态</div>
			<div field="writeUserName" width="70" headerAlign="center" align="center">填单人</div>
			<div field="auditUserName" width="70" headerAlign="center" align="center">审核人</div>
		</div>
	</div>
	</div>

<script type="text/javascript">
	mini.parse();
	
	var grid = mini.get("datagrid1");
	grid.load();

	function search(){
	     var serialNum = mini.get("serialNum").getValue();
	     var recallWhName = mini.get("recallWhName").getValue();
	     var callWhName = mini.get("callWhName").getValue();
	     
	     grid.load({ 
	        	serialNum: serialNum,
	        	recallWarehouseName: recallWhName,
	        	callinWarehouseName: callWhName,
	     });
	}
	
	//相关操作
 	function onActionRenderer(e) {
	    return '<a style="width:150px;" href="javascript:audit()">审核</a>';
    }
    
    function audit() {
        var row = grid.getSelected();
        if (row) {
            mini.open({
                url: "allocation_audit.do",
                title: "审核库件调拨", width: 900, height: 600,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var data = { action: "audit", row: row };
                    iframe.contentWindow.SetData(data);
                },
                ondestroy: function (action) {
                	if(action == 'succ'){
    	        		mini.showMessageBox({
    	                    title: "提示",
    	                    showModal:false,
    	                    iconCls: "mini-messagebox-warning",
    	                    message: "审核成功！",
    	                    timeout: 3000,
    	                    x: 'right',
    	                    y: 'bottom'
    	                });
    		            grid.reload();
    	        	}
                    grid.reload();
                }
            });
        } else {
            alert("请选中一条记录");
        }
    }
    
    function viewDetail() {
        var row = grid.getSelected();
        if (row) {
            mini.open({
                url: "storage_data_view.do",
                title: "调拨详细数据", width: 900, height: 600,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var data = { action: "viewDetail", row: row };
                    iframe.contentWindow.SetData(data);
                },
                ondestroy: function (action) {
                    grid.reload();
                }
            });
        } else {
            alert("请选中一条记录");
        }
    }
    
</script>
</body>
</html>